import Taro, { Component } from '@tarojs/taro'
import { View } from "@tarojs/components";
// import './index.scss'
import GRootPage from "../../../components/RootPage";
import GCellList from "../../../components/CellList";

/**
 * 用户自己的详情
 * @author zeng
 * @date   2020/5/21 11:34
 */
export default class CurrentUserDetail extends Component {

  onClick = cell => {
    switch (cell.value) {
      case 'avatar': {
        Taro.chooseImage({
          count: 1,
          success: result => {
            console.log(result)
          }
        })
        break
      }
      case 'sex': {
        Taro.showActionSheet({
          itemList: ['男', '女']
        })
        break
      }
      default: {
      }
    }
  }

  render () {
    return (
      <GRootPage headerType='page' title='编辑'>
        <View className='plr-30'>
          <GCellList
            data={[
              {
                value: 'avatar',
                title: '头像',
                extra: {
                  avatar: 'http://q1.qlogo.cn/g?b=qq&nk=704729872&s=640'
                },
              },
              {
                value: 'nickname',
                title: '昵称',
                extra: {
                  label: '曾小晨'
                },
                arrow: 'none'
              },
              {
                value: 'sex',
                title: '性别',
                extra: {
                  label: '男'
                },
              },
              {
                value: 'birthday',
                title: '生日',
                extra: {
                  label: '1997-04-28'
                }
              },
              {
                value: 'identity',
                title: '身份',
                extra: {
                  label: '摄影师'
                }
              },
              {
                value: 'mobile',
                title: '手机',
                extra: {
                  label: '19907313843'
                },
                arrow: ''
              },
              {
                value: 'wechat',
                title: '微信',
                isInput: true,
                extra: {
                  placeholder: '请输入微信号',
                  label: 'zengchen97'
                },
                arrow: ''
              },
              {
                value: 'signature',
                title: '签名',
                isTextArea: true,
                extra: {
                  placeholder: '请输入签名',
                  label: 'zengchen97'
                },
                arrow: ''
              }
            ]}
            onClick={this.onClick}
          />
        </View>
      </GRootPage>
    )
  }
}
